<?php
function convEnt($text){
return strip_tags(str_replace(
array("'",';', '"'), 
array("",'', ''), $text));
}

function get_value_of($name)
{
     $lines = file("../config.php");
     foreach (array_values($lines) AS $line)
     {
          list($key, $val) = explode('=', trim($line) );
          if (trim($key) == $name)
          {     $val = convEnt($val);
                return $val;
          }
     }
     return false;
} 

function write_value_of($var,$oldval,$newval)
{
$contents = file_get_contents('../config.php');
$regex = '~\\'.$var.'\s+=\s+\''.$oldval.'\';~is';
$contents = preg_replace($regex, "$var = '$newval';", $contents);
file_put_contents('../config.php', $contents);
}

?>